<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>提现明细</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, user-scalable=no">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta name=”apple-mobile-web-app-status-bar-style” content=”default”/>
    <meta name=”apple-mobile-web-app-status-bar-style” content=”black”/>
    <meta name=”apple-mobile-web-app-status-bar-style” content=”black-translucent”/>
    <meta content="telephone=no" name="format-detection">
    <meta content="email=no" name="format-detection">
    <meta name="format-detection" content="telephone=no"/>
    <link href="${s.base}/mobile/css/weui.min.css" rel="stylesheet"/>
    <link href="${s.base}/mobile/css/jquery-weui.min.css" rel="stylesheet">
    <link href="${s.base}/mobile/css/weReward.css" rel="stylesheet"/>
    <link href="${s.base}/mobile/css/weChat.css" rel="stylesheet"/>
</head>
<body ontouchstart style="width:100%;height:auto;overflow-y: auto;overflow-x: hidden!important;">
<div class="bountyList">
    <ul>
    </ul>
</div>
<div class="weui-loadmore">
    <i class="weui-loading"></i>
    <span class="weui-loadmore__tips">正在加载</span>
</div>
<div class="nodate-ctn" style="display: none">
    <p>
        <img src="${s.base}/mobile/images/nodates.png"><br>
        <span>暂无数据</span>
    </p>
</div>
</body>
<script type="text/javascript" src="${s.base}/mobile/js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="${s.base}/mobile/js/fontSize.js"></script>
<script type="text/javascript" src="${s.base}/mobile/js/jquery-weui.js"></script>
<script type="text/javascript" src="${s.base}/mobile/js/fastclick.js"></script>
<script type="text/javascript" src="${s.base}/mobile/js/common.js"></script>
<script>
    var page = 1;
    var limit = 10;
    var loading = false;
    $('.weui-loadmore').hide();
    $(".nodate-ctn").css("height", document.body.scrollHeight);

    $(function () {
        initData('1');
        initListener();
    });

    function initData(flag) {
        if (flag === '1') {
            $(document.body).infinite(100);
        }
        $.fn.doPost('/phone/reward/cashOut/page', {applyId: '${applyId}', token: '${token}', page: page, limit: limit}, function (result) {
            if (result.code === 0) {
                if (!result.hasNextPage) {
                    $(document.body).destroyInfinite();
                }
                if (flag === '1') {
                    $('.bountyList ul').html('');
                    $(document.body).pullToRefreshDone();
                } else if (flag === '2') {
                    loading = false;
                    $(".weui-loadmore").hide();
                }
                postData(result.data);
            } else {
                $.toast('获取数据失败', "text");
            }
        });
    }

    function initListener() {
        //初始化滚动加载
        $(document.body).infinite().on("infinite", function () {
            if (loading) return;
            loading = true;
            $('.weui-loadmore').show();
            setTimeout(function () {
                page++;
                initData('2');
            }, 1000);
        });
    }

    function postData(data) {
        var str = '';
        if (data != null && data.length > 0) {
            for (var i = 0; i < data.length; i++) {
                var e = data[i];
                str += '<li>';
                str += '<div class="user-Avatar"><img src="' + e.headLogo + '"></div>';
                str += '<h1 class="ellipsis">提现到银行卡</h1>';
                str += '<h2>' + e.createTime.substring(0, 19) + '</h2>';
                str += '<div class="bountyAmount color666">-' + e.money + '</div>';
                str += '</li>';
            }
        }
        if (isBlank(str)) {
            $('.bountyList ul').html(str);
        } else {
            $('.bountyList ul').append(str);
        }
        if ($('.bountyList li').length === 0) {
            $('.nodate-ctn').show();
        } else {
            $('.nodate-ctn').hide();
        }
    }
</script>
</html>